<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>ItemPage</title>
    <link rel="StyleSheet" href="../../css/mypetstore.css" type="text/css" media="screen"/>
</head>
<body>
<!--加一个，为了commit-->
<div id="Content">
    <div th:replace="jsp/common/top"></div>
    <div id="BackLink">
        <a th:href="@{/catalog/viewProduct(productId=${item.getProductid()})}"
           th:text="'Return to'+ ${item.getProductid()}">
            Return to productPage
        </a>
    </div>

    <div id="Catalog">

        <table>
            <tr>
                <td >
                    <div th:with="desc=${product.getDescn()}">
                        <span th:utext="${#strings.substringBefore(desc, '&lt;')}"></span>
                        <img th:src="${'../../'+desc.replaceFirst('.*src=&quot;([^&quot;]+)&quot;.*', '$1')}"
                             th:alt="${desc.replaceFirst('.*src=&quot;[^&quot;]+&quot;(.*)', '$1')}">
                        <span th:utext="${#strings.substringAfter(desc, '&gt;')}"></span>
                    </div>
                </td>
            </tr>
            <tr>
                <td><b th:text="${item.getItemid()}">  </b></td>
            </tr>
            <tr>
                <td><b><font size="4">
                    <span th:if="${item.attr1 != null}" th:text="${item.attr1}"></span>
                    <span th:if="${item.attr2 != null}" th:text="${item.attr2}"></span>
                    <span th:if="${item.attr3 != null}" th:text="${item.attr3}"></span>
                    <span th:if="${item.attr4 != null}" th:text="${item.attr4}"></span>
                    <span th:if="${item.attr5 != null}" th:text="${item.attr5}"></span>
                    <span th:text="${product.getName()}"></span>
<!--                    <span th:text="${product.getName()}"></span>-->
                </font></b></td>
            </tr>
            <tr>
                <td th:text="${product.getName()}"> product name</td>
            </tr>
            <tr>
                <td>

                    <span th:if="${inventory.getQty() <= 0}" th:text="'Back ordered.'"></span>
                    <span th:if="${inventory.getQty() > 0}" th:text="${inventory.getQty()}+' in stock.'"></span>

<!--                    <c:if test="${sessionScope.item.quantity <= 0}">-->
<!--                        Back ordered.-->
<!--                    </c:if>-->
<!--                    <c:if test="${sessionScope.item.quantity > 0}">-->
<!--                        ${sessionScope.item.quantity} in stock.-->
<!--                    </c:if>-->
                </td>
            </tr>
            <tr>
                <td th:text="'$'+${item.getListprice()}">
<!--                    <fmt:formatNumber value="${sessionScope.item.listPrice}"
                                      pattern="$#,##0.00"/>-->
                </td>
            </tr>

    <tr>
      <td>
          <a th:href="'/addItemToCart?' + 'workingItemId=' + ${item.itemid}">add to card</a>
      </td>
    </tr>
  </table>

    </div>
    <div th:replace="jsp/common/bottom"></div>
</div>

</body>
<script>
  function add() {
    location.href="http://localhost:8080/account/addItemToCart"
  }
</script>
</html>